package com.five.community.service.impl;

import com.five.community.bean.Chargedetailsmanagement;
import com.five.community.bean.vo.ChargedetailsmanagementVo;
import com.five.community.bean.vo.ComplaintVo;
import com.five.community.mapper.ChargedetailsmanagementMapper;
import com.five.community.service.ChargedetailsmanagementService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ChargedetailsmanagementServiceImpl implements ChargedetailsmanagementService {
    @Autowired
    private ChargedetailsmanagementMapper chargedetailsmanagementMapper;

    @Override
    public List<ChargedetailsmanagementVo> selectAll() throws Exception {
        return chargedetailsmanagementMapper.queryAllchargedetailsmanagementVo();
    }

    @Override
    public  List<ChargedetailsmanagementVo> selectByPservicecode(String pservicecode) throws Exception{
        return chargedetailsmanagementMapper.selectchargedetailsmanagementVobypservicecode(pservicecode);
    }
    @Override
    public void  deleteById(int id) throws Exception{
        chargedetailsmanagementMapper.DeleteById(id);
    }
    @Override
    public void insert(Chargedetailsmanagement chargedetailsmanagement) throws Exception{
        chargedetailsmanagementMapper.Insert(chargedetailsmanagement);
    }
    @Override
    public  Chargedetailsmanagement selectbyid(int id) throws Exception{
       return chargedetailsmanagementMapper.SelectById(id);
    }
    @Override
    public void update(Chargedetailsmanagement chargedetailsmanagement)throws  Exception{
         chargedetailsmanagementMapper.Update(chargedetailsmanagement);
    }


    @Override
    public PageInfo<ChargedetailsmanagementVo> getPageInfo(Integer pageNum, int pageSize) throws Exception {
        //先初始化模型在查询信息顺序不能颠倒
        //初始化分页插件模型
        PageHelper.startPage(pageNum,pageSize);
        //查询所有信息获得列表集合
        List<ChargedetailsmanagementVo> chargedetailsmanagementVos = chargedetailsmanagementMapper.queryAllchargedetailsmanagementVo();
        //分页模型加入数据
        PageInfo<ChargedetailsmanagementVo> pageInfo = new PageInfo<>(chargedetailsmanagementVos);
        //返回分页模型
        return pageInfo;
    }

}
